﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Storage;
using Factory;
using UserInterface;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            Present present = TastiesFactory.CreatePresent();
            ConsoleLogger clog = ConsoleLoggerFactory.CreateLogger();
            FileLogger flog = FileLoggerFactory.CreateLogger();
            flog.CreateFile();

            PresentReader.showList();
            int t = PresentReader.readTasties();
            int w = PresentReader.readWeight();
            present.add_snack(TastiesFactory.CreateTasty(t-1,w));
            clog.Log("Добавлен новый элемент.");
            flog.Log("Добавлен новый элемент.");

            int c = PresentReader.readMore();

            while (c != 0)
            {
                t = PresentReader.readTasties();
                w = PresentReader.readWeight();
                present.add_snack(TastiesFactory.CreateTasty(t - 1, w));
                clog.Log("Добавлен новый элемент.");
                flog.Log("Добавлен новый элемент.");
                c = PresentReader.readMore();
            }
            clog.Log("Запрошен список сладостей.");
            flog.Log("Запрошен список сладостей.");
            PresentPrinter.printTasties(present.get_snacks());
            clog.Log("Запрошен вес подарка.");
            flog.Log("Запрошен вес подарка.");
            PresentPrinter.printTotal(present.count_total_weight());
            Console.ReadKey();
        }
    }
}
